<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>KeyDragZoom for V2 v2.0.1 [October 13, 2010] Reference</title>
    <link rel="stylesheet" type="text/css" href="http://code.google.com/css/codesite.css"></link>
    <link rel="stylesheet" type="text/css" href="../../util/docs/template/local_extensions.css"></link>
  </head>
  <body>
    <h1>KeyDragZoom for V2</h1>
    <p>
This library adds a drag zoom capability to a V2 Google map. When drag zoom is enabled, holding down a designated hot key <code>(shift | ctrl | alt)</code> while dragging a box around an area of interest will zoom the map in to that area when the mouse button is released. Optionally, a visual control can also be supplied for turning a drag zoom operation on and off. Only one line of code is needed: <code>GMap2.enableKeyDragZoom();</code> <p> Note that if the map's container has a border around it, the border widths must be specified in pixel units (or as thin, medium, or thick). This is required because of an MSIE limitation.</p>
    <p>For a description and examples of how to use this library, check out the <a href="examples.html">how-to</a>.</p>
    
      <h2><a name="DragZoom"></a>class DragZoom</h2>
      <p>This class represents a drag zoom object for a map. The object is activated by holding down the hot keyor by turning on the visual control.This object is created when <code>GMap2.enableKeyDragZoom</code> is called; it cannot be created directly.Use <code>GMap2.getDragZoomObject</code> to gain access to this object in order to attach event listeners.</p>
      
        <h3>Events</h3>
        <table summary="class DragZoom - Events" width="90%">
          
          <tbody>
            <tr>
              <th>Events</th>
              
                
                  <th>Arguments</th>
                
              
              <th>Description</th>
            </tr>
            
              <tr class="odd">
                <td><code>activate</code></td>
                
                  
                    <td><code>None</code></td>
                  
                
                <td>This event is fired when the hot key is pressed.</td>
              </tr>
            
              <tr class="even">
                <td><code>deactivate</code></td>
                
                  
                    <td><code>None</code></td>
                  
                
                <td>This event is fired when the hot key is released.</td>
              </tr>
            
              <tr class="odd">
                <td><code>drag</code></td>
                
                  
                    <td><code><span class="type">southwestPixel:GPoint</span>, <span class="type">northeastPixel:GPoint</span></code></td>
                  
                
                <td>This event is fired repeatedly while the user drags a box across the area of interest.The southwest and northeast point are passed as parameters of type <code>GPoint</code>(for performance reasons), relative to the map container. Note: the event listener is responsible for converting pixel position to geographic coordinates, if necessary, using<code>GMap2.fromContainerPixelToLatLng</code>.</td>
              </tr>
            
              <tr class="even">
                <td><code>dragend</code></td>
                
                  
                    <td><code><span class="type">bnds:GLatLngBounds</span></code></td>
                  
                
                <td>This event is fired when the drag operation ends.The parameter passed is the geographic bounds of the selected area.Note that this event is <i>not</i> fired if the hot key is released before the drag operation ends.</td>
              </tr>
            
              <tr class="odd">
                <td><code>dragstart</code></td>
                
                  
                    <td><code><span class="type">latlng:GLatLng</span></code></td>
                  
                
                <td>This event is fired when the drag operation begins.The parameter passed is the geographic position of the starting point.</td>
              </tr>
            
          </tbody>
        </table>
      
    
      <h2><a name="GMap2"></a>class GMap2</h2>
      <p>These are new methods added to the Google Maps JavaScript API V2's<a href="http://code.google.com/apis/maps/documentation/javascript/v2/reference.html#GMap2">GMap2</a>class.</p>
      
        <h3>Methods</h3>
        <table summary="class GMap2 - Methods" width="90%">
          
          <tbody>
            <tr>
              <th>Methods</th>
              
                
                  <th>Return&nbsp;Value</th>
                
              
              <th>Description</th>
            </tr>
            
              <tr class="odd">
                <td><code>disableKeyDragZoom()</code></td>
                
                  
                    <td><code>None</code></td>
                  
                
                <td>Disables drag zoom.</td>
              </tr>
            
              <tr class="even">
                <td><code>enableKeyDragZoom(<span class="type">opt_zoomOpts:KeyDragZoomOptions</span>)</code></td>
                
                  
                    <td><code>None</code></td>
                  
                
                <td>Enables drag zoom. The user can zoom to an area of interest by holding down the hot key<code>(shift | ctrl | alt )</code> while dragging a box around the area or by turningon the visual control then dragging a box around the area.</td>
              </tr>
            
              <tr class="odd">
                <td><code>getDragZoomObject()</code></td>
                
                  
                    <td><code>DragZoom</code></td>
                  
                
                <td>Returns the DragZoom object which is created when <code>GMap2.enableKeyDragZoom</code> is called.With this object you can use <code>GEvent.addListener</code> to attach event listenersfor the "activate", "deactivate", "dragstart", "drag", and "dragend" events.</td>
              </tr>
            
              <tr class="even">
                <td><code>keyDragZoomEnabled()</code></td>
                
                  
                    <td><code>Boolean</code></td>
                  
                
                <td>Returns <code>true</code> if the drag zoom feature has been enabled.</td>
              </tr>
            
          </tbody>
        </table>
      
    
      <h2><a name="KeyDragZoomOptions"></a>class KeyDragZoomOptions</h2>
      <p>This class represents the optional parameter passed into <code>GMap2.enableKeyDragZoom</code>.  There is no constructor for this class.  Instead, this class is instantiated as a javascript object literal.</p>
      
        <h3>Properties</h3>
        <table summary="class KeyDragZoomOptions - Properties" width="90%">
          
          <tbody>
            <tr>
              <th>Properties</th>
              
                
                  <th>Type</th>
                
              
              <th>Description</th>
            </tr>
            
              <tr class="odd">
                <td><code>boxStyle</code></td>
                
                  
                    <td><code>Object</code></td>
                  
                
                <td>An object literal defining the css styles of the zoom box. The default is <code>{border: "4px solid #736AFF"}</code>. Border widths must be specified in pixel units (or as thin, medium, or thick).</td>
              </tr>
            
              <tr class="even">
                <td><code>key</code></td>
                
                  
                    <td><code>String</code></td>
                  
                
                <td>The hot key to hold down to activate a drag zoom, <code>shift | ctrl | alt</code>. Note that the <code>alt</code hot key refers to the Option key on a Macintosh. The default is <code>shift</code>.</td>
              </tr>
            
              <tr class="odd">
                <td><code>veilStyle</code></td>
                
                  
                    <td><code>Object</code></td>
                  
                
                <td>An object literal defining the css styles of the veil pane which covers the map when a drag zoom is activated. The previous name for this property was <code>paneStyle</code> but the use of this name is now deprecated. The default is <code>{backgroundColor: "gray", opacity: 0.25, cursor: "crosshair"}</code>.</td>
              </tr>
            
              <tr class="even">
                <td><code>visualEnabled</code></td>
                
                  
                    <td><code>Boolean</code></td>
                  
                
                <td>A flag indicating whether a visual control is to be used. The default is <code>false</code>.</td>
              </tr>
            
              <tr class="odd">
                <td><code>visualPosition</code></td>
                
                  
                    <td><code>GControlPosition</code></td>
                  
                
                <td>The position of the visual control. The default position is (27,285) relative to the top left corner of the map.</td>
              </tr>
            
              <tr class="even">
                <td><code>visualSize</code></td>
                
                  
                    <td><code>GSize</code></td>
                  
                
                <td>The width and height values provided by this property are the size (in pixels) of each of the images within <code>visualSprite</code>. The default is (20,20).</td>
              </tr>
            
              <tr class="odd">
                <td><code>visualSprite</code></td>
                
                  
                    <td><code>String</code></td>
                  
                
                <td>The URL of the sprite image used for showing the visual control in the on, off, and hot (i.e., when the mouse is over the control) states. The three images within the sprite must be the same size and arranged in on-hot-off order in a single row with no spaces between images. The default is <code>http://maps.gstatic.com/mapfiles/ftr/controls/dragzoom_btn.png</code>.</td>
              </tr>
            
              <tr class="even">
                <td><code>visualTips</code></td>
                
                  
                    <td><code>Object</code></td>
                  
                
                <td>An object literal defining the help tips that appear when the mouse moves over the visual control. The <code>off</code> property is the tip to be shown when the control is off and the <code>on</code> property is the tip to be shown when the control is on. The default values are "Turn on drag zoom mode" and "Turn off drag zoom mode", respectively.</td>
              </tr>
            
          </tbody>
        </table>
      
    
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
    <script type="text/javascript">
      _uacct = "UA-964209-4";
      urchinTracker();
    </script> 
  </body>
</html>
